package com.neuedu.web.listener;

import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @author 金山
 * 项目：javaweb
 * site: https://blog.fulfill.com.cn
 * 描述
 *
 *
 *
 * HttpServletRequest     request
 * HttpServletResponse     response
 * HttpSession            session
 * ServletContext       application
 *
 *
 * @data 2024/11/1813:58
 */
// @WebListener
public class ContextAttributeLinstener implements ServletContextAttributeListener {


    @Override
    public void attributeAdded(ServletContextAttributeEvent scae) {
        System.out.println("ContextAttributeLinstener.attributeAdded");

        String key = scae.getName();
        Object value = scae.getValue();

        System.out.println("key = " + key);
        System.out.println("value = " + value);


    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent scae) {
        System.out.println("ContextAttributeLinstener.attributeReplaced");
        String key = scae.getName();
        Object value = scae.getValue();

        System.out.println("key = " + key);
        System.out.println("value = " + value);
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent scae) {
        System.out.println("ContextAttributeLinstener.attributeRemoved");
        String key = scae.getName();
        Object value = scae.getValue();

        System.out.println("key = " + key);
        System.out.println("value = " + value);
    }



}
